import React, { Component } from 'react';
// 3. 替换掉BrowserRouter，使用Router + history的方式自行绑定Router和history
import { Router, Route, Switch } from 'react-router-dom';
import Login from './pages/Login/index';
import Layout from './pages/Layout/index';
import AuthRoute from './components/AuthRoute';
import TestPage from './pages/testPage/index'
import history from 'utils/history';

export default class App extends Component {
  render() {
    // BrowserRouter  等价于 Router+ history
    return (
      // 🔔 history作为组件属性设置在Router身上
      <Router history={history}>
        <Switch>
          <Route path="/login" component={Login}></Route>
          <Route path="/test" component={TestPage}></Route>
          <AuthRoute path="/" component={Layout}></AuthRoute>
        </Switch>
      </Router>
    );
  }
}
